UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tR0lybK+MCjinOOc7Mja0XLPdsbeAhpsrRtagv8RA1Q=' 
WHERE 
  key_id = '10b322cee41fb610611bdf425e9205077749453b5bd7d7ecc22faffe48d8d72f' 
  AND (
    token = 'tR0lybK+MCjinOOc7Mja0XLPdsbeAhpsrRtagv8RA1Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029