UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ros3yH9mznbm3G1XUr6tgM6VTpF8crDCUCgMGveb5ds=' 
WHERE 
  key_id = '3e420b86531a392747415851e20a98c0b5fcb63b223797371bebb9b456bc5a78' 
  AND (
    token = 'ros3yH9mznbm3G1XUr6tgM6VTpF8crDCUCgMGveb5ds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033