UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0Th2qJ8MwkTpRnirFWQXSSC0V33buv7Q0qQVeYlf+Eg=' 
WHERE 
  key_id = '778a28d122f1b053aa1951f4915a115a7babb8936e359aa385a159caff802495' 
  AND (
    token = '0Th2qJ8MwkTpRnirFWQXSSC0V33buv7Q0qQVeYlf+Eg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032