UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't5T2TImtCgJhPmjbquVli7ZNE19/HFdVHOxhYll2m0g=' 
WHERE 
  key_id = 'c709e722955c70ba759f1c6c907e134019756cf701261763b5f62454296dc09a' 
  AND (
    token = 't5T2TImtCgJhPmjbquVli7ZNE19/HFdVHOxhYll2m0g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022