UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B/v72fd+A5ae3OuZjufjVanQrgXtyoptGO/eSrfZP+o=' 
WHERE 
  key_id = '0a64deaae5d4430eeccc48485c52e7006da374b8434f508bc05c62d8efdbe5b2' 
  AND (
    token = 'B/v72fd+A5ae3OuZjufjVanQrgXtyoptGO/eSrfZP+o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038