UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M7EW/sK4f7ahTTEPQym0zy3YMSRNTujl1b78utl9nMg=' 
WHERE 
  key_id = 'ef65ba8114a0a9a6f4c3fee8c7e951fc81eeb342786e9dbb21bc2a660d072596' 
  AND (
    token = 'M7EW/sK4f7ahTTEPQym0zy3YMSRNTujl1b78utl9nMg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041