UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '48zlSaElqeKWpi7h+RCIx1odpV609hgHTmBjKkckjvo=' 
WHERE 
  key_id = 'f6ad640f567a5bb2dbb33f2fb762923a40679efc169a6181b6a501604df29795' 
  AND (
    token = '48zlSaElqeKWpi7h+RCIx1odpV609hgHTmBjKkckjvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046