UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GhVmKxpBnZufOqZ0qr9rdlN6JrZgVPIXX1H62d2Z5P8=' 
WHERE 
  key_id = 'f66efeedac7c6188439bd9f79785e1d14239baa790c828d67f444759c069c2fc' 
  AND (
    token = 'GhVmKxpBnZufOqZ0qr9rdlN6JrZgVPIXX1H62d2Z5P8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041