UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K3aK+HV5aTQZnSM4Fdu+9LjMljVF6by5gcm6lv+vjp4=' 
WHERE 
  key_id = '1f34f5f1472fda57e69e5c17e3a2b73006f8f50adeb71c606b480c2185e72a6a' 
  AND (
    token = 'K3aK+HV5aTQZnSM4Fdu+9LjMljVF6by5gcm6lv+vjp4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042