UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NQ5Di3ZzHq0ui7PvsDrfyNjaP1IGv19x5mOb9qsCYe8=' 
WHERE 
  key_id = '7c5198a287b7044e854806403114d549020c448bb967880b9f30e802c6b2d64f' 
  AND (
    token = 'NQ5Di3ZzHq0ui7PvsDrfyNjaP1IGv19x5mOb9qsCYe8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029