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

Query time 0.00023