UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N4xBzOSfPUztbv98b6d0BkTml5Sk4oNR/gS496/wYLM=' 
WHERE 
  key_id = '6ef81821473813a773855bf19beddad620853f7182bfb7a7483c06fd803c4712' 
  AND (
    token = 'N4xBzOSfPUztbv98b6d0BkTml5Sk4oNR/gS496/wYLM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036