UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SQlCGjvCSPAiLTWkr9YA8VCAwbtTqoGl/PJnAF85pDA=' 
WHERE 
  key_id = '313f580a1efa4c807c5c0b170b4d418ade1137f61aab50222c4b0938baafe03b' 
  AND (
    token = 'SQlCGjvCSPAiLTWkr9YA8VCAwbtTqoGl/PJnAF85pDA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038