UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w0EHA2onwJqHBPbn+Zjb6RBwe2yWq+VLDJ5c+N/nsTw=' 
WHERE 
  key_id = 'ef7af40950193cfe6e8461934a83fc66fed1230bc900b5b6c6810493bec71bd2' 
  AND (
    token = 'w0EHA2onwJqHBPbn+Zjb6RBwe2yWq+VLDJ5c+N/nsTw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029