UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LG7jjqB5YqOrJQrP/Ccetf4LsPKoKoz001iZQ7x+QvE=' 
WHERE 
  key_id = '912f30152638864c6b0bd7b15774a2188b3060cec33b1653a9db47d86a829654' 
  AND (
    token = 'LG7jjqB5YqOrJQrP/Ccetf4LsPKoKoz001iZQ7x+QvE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029