UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f8JsV87aA2S0GsHyXgftBrY8iFNEfapqzP5J2ZekZms=' 
WHERE 
  key_id = '24993e745ca1590c7d337e5b741ad49870ac51981d4a29557c65add937c487b0' 
  AND (
    token = 'f8JsV87aA2S0GsHyXgftBrY8iFNEfapqzP5J2ZekZms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033