UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gEKIq3EUGe2HUSAQIWqI3mu/Le4YbvE1lUmX55qKgZs=' 
WHERE 
  key_id = 'efd86ca06202f7b5e3038700650ab05a14fdfe074ddff4e6fc61c4a69ba7d461' 
  AND (
    token = 'gEKIq3EUGe2HUSAQIWqI3mu/Le4YbvE1lUmX55qKgZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040