UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QyiHDwDXDF1cOXbfzsIbcZaUn5DBvpWy2W0vnGh+WPA=' 
WHERE 
  key_id = '862bfbd5d0c16d4f1b386b7b06d4a19f9eda4e5d9b50e2c331070e97af1e8294' 
  AND (
    token = 'QyiHDwDXDF1cOXbfzsIbcZaUn5DBvpWy2W0vnGh+WPA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043