UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9OLIzH7KSuei+zOKoedkZJCGExfu/GdSrj6xDuDccps=' 
WHERE 
  key_id = '2047071d08870e2516cf4222288a0069812fa0d0ba33b0d3415c801562955f0a' 
  AND (
    token = '9OLIzH7KSuei+zOKoedkZJCGExfu/GdSrj6xDuDccps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044