UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r1koO041LRNRYLKtkpe/e6WRnLNetejDcED4XQExjeA=' 
WHERE 
  key_id = 'b325fba680803243bdc1154e77c788dc12f92b509c46c1bfb08f6c92523aba29' 
  AND (
    token = 'r1koO041LRNRYLKtkpe/e6WRnLNetejDcED4XQExjeA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034