UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cKsEKyne1iiNPT4IVrvd72exJnttdDQZwsmpxu6K4RI=' 
WHERE 
  key_id = 'fa2550d52f005665ecb7e035d12a7c82308aea48e95195f01109eb6c8d5a07e4' 
  AND (
    token = 'cKsEKyne1iiNPT4IVrvd72exJnttdDQZwsmpxu6K4RI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041