UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CkBb/9yTY1u8TFwZB+ZXicwV2r8ODFCQ4IbaGWpHbtc=' 
WHERE 
  key_id = '876b90b491741b18da78eb158069dda92a91396b80ba2d7e34e79c9ae0cb2bb1' 
  AND (
    token = 'CkBb/9yTY1u8TFwZB+ZXicwV2r8ODFCQ4IbaGWpHbtc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027