UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fj7M6IZu/useLrCsm5xqOtdaI7vuvcQerw2ErYyM2+Y=' 
WHERE 
  key_id = 'f9736cf26fd76b55c47926158721931a3a047239a0377296800038f1b6728a9b' 
  AND (
    token = 'fj7M6IZu/useLrCsm5xqOtdaI7vuvcQerw2ErYyM2+Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029