UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rJl9qhcw6wbThUx7uX9Ox9U7yFCoPya8ZrndPA91jwE=' 
WHERE 
  key_id = '9d3a5db1c76a8230146c85104a43f62c2a59b14f067c967d5c61f2e929a379d5' 
  AND (
    token = 'rJl9qhcw6wbThUx7uX9Ox9U7yFCoPya8ZrndPA91jwE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022