UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RHX0YhnNND0NabRStTXc/B3HGjtqilthJoIXNPQHJ8Y=' 
WHERE 
  key_id = 'f5d782f1e59dd8142b864e505debb19f8dd07e239345f5247266f68709a52ce5' 
  AND (
    token = 'RHX0YhnNND0NabRStTXc/B3HGjtqilthJoIXNPQHJ8Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026