UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KFNEVYjjH4Tg6J8Y9LGf+Sd1DVk7cKpAgAbqbofOprU=' 
WHERE 
  key_id = 'bc8b02ff9aa8ee4240db78b25a1cec5cca6ce96175575cd3191b64361317d739' 
  AND (
    token = 'KFNEVYjjH4Tg6J8Y9LGf+Sd1DVk7cKpAgAbqbofOprU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025