UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sGXEWBnQLEue5ylZx8O29iK5ArmIUWFI6/COtXnnQbE=' 
WHERE 
  key_id = 'f9f70e9e730dae3d1b6dd5f4a25650aa3512816f4ac857cc148bc2f9669ef81e' 
  AND (
    token = 'sGXEWBnQLEue5ylZx8O29iK5ArmIUWFI6/COtXnnQbE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049