UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TrI2zlJBnmHMFeimCStvqbPUwZoRgiSxN70uesGkF5o=' 
WHERE 
  key_id = 'b708a2d1f398280b0a35a90e6ec8ef08b079c08b0134d53f9e5d9edeea230597' 
  AND (
    token = 'TrI2zlJBnmHMFeimCStvqbPUwZoRgiSxN70uesGkF5o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027