UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2eoBgWASPsxsFv+esR33ymk9jnKyUon+x6P2bFgnbhE=' 
WHERE 
  key_id = 'ff9a881b3d1bdd62ec3352b4379a356e9da8216926bd147c6401e24d1dd7cd3d' 
  AND (
    token = '2eoBgWASPsxsFv+esR33ymk9jnKyUon+x6P2bFgnbhE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020